@extends('cms/system/admin/template/theme_default/common')
@section('page-body')
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-body">
                <div class="layui-form layui-form-pane" id="exam-app-form" lay-filter="exam-app-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label">测试字段</label>
                        <div class="layui-input-block">
                            <input class="layui-input" type="text" name="setting[test]" value="" placeholder="请输入名称" autocomplete="off" lay-verify="required" required />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="submit-setting">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        layui.config({
            base: '/layui-admin/'
        }).extend({
            index: 'lib/index'
        }).use(['index'], function () {
            // 提交
            layui.form.on('submit(submit-setting)', function (data) {
                // 获取提交的字段
                var formField = data.field;
                // ajax提交
                layui.$.ajax({
                    url: layui.setter.apiLink + '/exam/admin_app/setting?id={{$data['id'] ?? 0}}',
                    type: 'POST',
                    data: formField,
                    success: function (result) {
                        console.log('提交结果：', result);
                    }
                });
            });
        });
    </script>
@endsection